home *** CD-ROM | disk | FTP | other *** search
- /*
- * a header of the basic utilities
- * Copyright (C) 1996, 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #ifndef _BASE_H_
- #define _BASE_H_
-
- #include "typedef.h"
-
- template<class T>
- const T& maximum(const T& a, const T& b)
- {
- return (a < b) ? b : a;
- }
-
- template<class T>
- const T& minimum(const T& a, const T& b)
- {
- return (a < b) ? a : b;
- }
-
- template<class T>
- void swap(T& a, T& b)
- {
- T temp = a;
- a = b;
- b = temp;
- }
-
- template<class T>
- void sort2(T& a, T& b)
- {
- if(b < a) {
- swap(a, b);
- }
- }
-
- template<class TABLE_ELEMENT_T, class INDEX_T>
- uint search_info_table(const TABLE_ELEMENT_T table[], uint sentinel, INDEX_T key)
- {
- for(int i = 0; table[i]() != sentinel; i++) {
- if(table[i]() == key) {
- break;
- }
- }
- return i;
- }
-
- #define M_PI 3.14159265358979
-
- #endif /* _BASE_H_ */
-